<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean"%>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="/WebFinalProject/css/FinalProjectCSS.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="table.js"></script>
<script type="text/javascript" src="js/MasterJS.js"></script>
<script type="text/javascript">	
	function ubah(task, id) {
		document.forms[0].task.value = task;
		document.forms[0].idUpdate.value = id;
		//alert(task+", "+id);
		document.forms[0].submit();
	}
</script>
<title>Manage Forum</title>
</head>
<%
	if(session.getAttribute("result") != null)
	{
		String message = session.getAttribute("result").toString();
		%>
			<script type="text/javascript">
				window.alert('<%=message%>');
			</script>
		<%
		session.removeAttribute("result");
	}	
%> 
<body>
	<center>
		<table width="100%" class="bodyTable boxShadow">
		
			<!-- Header -->
			<tr>
				<td colspan="2"><%@include file="/include/Header.jsp"%></td>
			</tr>
		
			<!-- Content -->
			<tr>
				<td rowspan="2" width="200px" class="navigationBox"><%@include file="/include/Navigation.jsp"%></td>
				<td align="left" class="headerBox blueBackground">Setting > Manage Forum</td>
			</tr>
			<tr>
				<td align="center"  class="contentStyle"><br>
					<html:form action="/Forum" method="post">
					<html:hidden property="task"/>
					<html:hidden property="idUpdate"/>
					<br />
					<table border="0" width="95%" align="center" class="boxShadow  example table-autosort  table-autofilter table-autopage:10 table-stripeclass:alternate table-page-number:t1page table-page-count:t1pages table-filtered-rowcount:t1filtercount table-rowcount:t1allcount" id="t1">					
						<thead>
							<tr class="headerBox formHeaderBackground">
								<th colspan="2" align="center" class="formListStyle filterable table-sortable:default">Thread Title</th>
								<th width="150px" align="center" class="formListStyle filterable table-sortable:default">Created Date</th>
								<th width="150px" align="center" class="formListStyle filterable table-sortable:default">Last Posting</th>
								<th width="100px" align="center" class="formListStyle filterable table-sortable:default">Status</th>
								<th width="55px"></th>
							</tr>
							<tr>
								<th colspan="2" align="center" class="formListStyle table-filterable"></th>
								<th align="center" class="formListStyle table-filterable"></th>
								<th align="center" class="formListStyle table-filterable"></th>
								<th align="center" class="formListStyle table-filterable"></th>
								<th></th>
							</tr>
						</thead>
						<tbody>
							<logic:notEmpty name="forumThreadForm" property="listForumThread">
								<logic:iterate id="listData" name="forumThreadForm" property="listForumThread">
									<tr class="formListBackground">
										<td class="formListStyle leftAlign" colspan="2" style="word-wrap:break-word;"><bean:write name="listData" property="threadTitle"></bean:write></td>
										<td align="center" class="formListStyle"><bean:write name="listData" property="createdDate"/></td>
										<td align="center" class="formListStyle"><bean:write name="listData" property="lastPostingDate"/></td>
										<td align="center" class="formListStyle"><bean:write name="listData" property="status"></bean:write></td>
										<td align="center" class="formListStyle">
												<img src="images/editButton.png" title="edit" style="cursor: pointer;" onclick="javascript:ubah('edit','<bean:write name="listData" property="forumThreadId"/>');"/>
<%-- 											<input type="button" class="buttonStyle" value="Update" onclick="javascript:ubah('edit','<bean:write name="listData" property="forumThreadId"/>');"> --%>
										</td>
									</tr>
								</logic:iterate>
							</logic:notEmpty>
							<logic:empty name="forumThreadForm" property="listForumThread">
								<tr class="formListBackground">
									<td colspan="6" class="formListStyle" align="center">Data is Not Found</td>
								</tr>
							</logic:empty>
						</tbody>
						<tfoot>
							<tr class="headerBox formHeaderBackground">
								<td width="80px" class="table-page:previous formListStyle" style="cursor:pointer;">&lt;&lt; Previous</td>
								<td colspan="4" style="text-align:center; vertical-align: middle;">Page <span id="t1page"></span>&nbsp;of <span id="t1pages"></span></td>
								<td width="55px" align="right" class="table-page:next formListStyle" style="cursor:pointer;">Next &gt;&gt;</td>
							</tr>
							<tr>
								<td colspan="6" title="add new" align="center" class="greyBackground">						
									<div class="insertButtonGridStyle" onclick="javascript:flyToPage('insert');">
										<table>
											<tr>
												<td class="formListStyle"><img src="images/addButton.png"></td>
												<td class="formListStyle"><b>Add New Thread</b></td>
											</tr>
										</table>
									</div>									
								</td>
							</tr>	
<!-- 							<tr class="formListStyle"> -->
<!-- 								<td colspan="5" align="center" style="padding:5px 7px;"> -->
<!-- 									<input type="button" class="buttonStyle" value="Insert" onclick="javascript:flyToPage('insert')"/> -->
<!-- 								</td> -->
<!-- 								<td colspan="2" align="center" style="vertical-align:middle; padding:5px 7px;"> -->
<!-- 									<a href="javascript:flyToPage('forumPage')">Go to Forum Page</a> -->
<!-- 								</td> -->
								<!-- <td align="right" style="vertical-align:middle; padding:5px 7px;">
									<a href="javascript:flyToPage('question')">Go to Question</a>
								</td> -->
<!-- 							</tr>							 -->
							<tr>
								<td colspan="6" align="center" class="headerBox formHeaderBackground">
									<span id="t1filtercount"></span>&nbsp;of <span id="t1allcount"></span>&nbsp;rows match filter(s)
								</td>
							</tr>
						</tfoot>
					</table>
				</html:form><br><br>
				</td>
			</tr>
			
			<!-- Footer -->
			<tr>
				<td align="center" colspan="2" class="headerBox blueBackground">&copy; OME. 2014. All Rights Reserved.</td>
			</tr>
		</table>
	</center>	
</body>
</html>